<div class="container-fluid">
  <a class='label label-success pull-right' href='/image/list/' style='margin-right:5px;'>全部</a>
  <?php foreach(Collection::all() as $c):?>
  <a class='label label-success pull-right' href='/image/list/?collection_id=<?php echo $c->id;?>' style='margin-right:5px;'><?php echo $c->name;?></a>
  <?php endforeach;?>
  <span class='label label-info'>图片列表</span>
    <div style='border-top:1px solid #ddd;'></div>
    <ul style='margin:20px auto;width:100%;'>
    <?php foreach ($imgs as $i):?>
      <li style='float:left;list-style:none;margin:5px;padding:5px;' class='unselected'>
        <img data-img-id='<?php echo $i->id;?>' class='product' src='<?php echo $i->url;?>' style='width:200px;height:200px;'/>
        <div style='padding:5px;margin-top:10px;height:150px;border-top:1px solid #ddd;width:200px;'>
          <p><a href='<?php echo $i->product->click_url;?>' target='_blank'><?php echo $i->product->title;?></a></p>
          <ul style='margin:0px;'>
            <?php foreach ($i->tags as $t):?>
            <li style='list-style:none;float:left;margin:0 5px;'>
              <a class='label' href='/image/list/?tag=<?php echo $t->name;?>&collection_id=<?php echo $collection_id;?>'><?php echo $t->name;?></a>
            </li>
            <?php endforeach;?>
          </ul>
          <div style='clear:both;height:10px;'></div>
<?php 
$tags = array();
foreach ($i->tags as $v) {
  $tags[] = $v->name;
}
$tags = implode(',', $tags);
?>
          <a class='label label-success pull-right edit' data-tags='<?php echo $tags;?>' data-img-id='<?php echo $i->id;?>' style='margin:3px;' href='javascript:void(0)'>编辑标签</a>
          <a class='label label-important pull-right delete' data-img-id='<?php echo $i->id;?>' style='margin:3px;' href='javascript:void(0)'>删除</a>

        </div>
      </li>
    <?php endforeach;?>
    </ul>
    <div style='height:10px;clear:both;'></div>
    <div class="pagination pull-right">
      <ul><?php echo $page;?></ul>
    </div>
</div>
<div id='float_toolbar'>
  <a href='javascript::void(0)' class='label label-success' id='add_tag' >批量加标签</a>
</div>


<div class="modal hide fade" id='tag_modal'>
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>添加标签</h3>
  </div>
  <div class="modal-body">
    <div class="input-append">
      <input class="span4" id="tags" name='tags' type="text">
      <button class="btn" type="button" id='add_tag_btn'>贴标签</button>
    </div>
  </div>
  <div class="modal-footer">
    <a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">Close</a>
  </div>
</div>

<div class="modal hide fade" id='tag_modal2'>
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>编辑标签</h3>
  </div>
  <div class="modal-body">
    <div class="input-append">
      <input class="span4" id="tags2" name='tags' type="text">
      <button class="btn" type="button" id='add_tag_btn2'>贴标签</button>
    </div>
  </div>
  <div class="modal-footer">
    <a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">Close</a>
  </div>
</div>


<style>
#float_toolbar{
position:fixed;
top:100px;
right:50px;
width:50px;
height:100px;
}
li.selected{
border:3px solid green;
}
li.unselected{
border:3px solid #ddd;
}
</style>
